package com.crm.mapper.system;

import com.crm.aonnation.AutoFill;
import com.crm.dto.MenuDto;
import com.crm.enumeration.OperationType;
import com.crm.pojo.Menu;
import com.crm.vo.TreeselectVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper {
    /**
     * 查询菜单列表
     *
     * @return
     */
    @Select("select * from sys_menu;")
    List<Menu> queryMenuList();

    /**
     * 删除菜单
     *
     * @param menuId
     */
    @Delete("delete  from sys_menu where menu_id=#{menuId}")
    void deleteMenu(Long menuId);

    @AutoFill(OperationType.INSERT)
    void addMenu(Menu menu);

    @Select("select * from sys_menu where menu_id=#{menuId}")
    Menu queryById(Long menuId);

    void updateMenu(Menu menu);

    @Select("SELECT menu_id id,parent_id,menu_name label FROM sys_menu")
    List<TreeselectVO> selectAllMenus();
}
